const Koa = require("koa")

let app = new Koa()

const static = require("koa-static");

const path = require("path")

const query = require("./middleware/query")

const router = require("./routers/index");

const bodyParser = require("koa-bodyparser");




app.use(bodyParser())
app.use(query())
app.use(static(path.join(process.cwd(), "public")))

app.use(router.routes());
app.use(router.allowedMethods())









app.listen(process.env.PORT || 3000, () => {
    console.log("服务启动成功");
})